System and method for lagrangian parameter calculation for display stream compression (DSC)

ABSTRACT

According to certain aspects, an apparatus for coding video data includes a memory for storing the video data and a processor. The memory includes a buffer. The processor is configured to receive the video data to be coded. The processor is further configured to determine a Lagrangian parameter for a coding mode based at least in part on a bit rate of the coding mode and a fullness of the buffer.

INCORPORATION BY REFERENCE TO PRIORITY APPLICATIONS

This application claims the benefit of U.S. Provisional Application No. 61/979,985, filed Apr. 15, 2014, and U.S. Provisional Application No. 62/034,080, filed Aug. 6, 2014, each of which is incorporated by reference in its entirety. Any and all applications for which a foreign or domestic priority claim is identified in the Application Data Sheet as filed with the present application are hereby incorporated by reference under 37 CFR 1.57.

BACKGROUND

Technical Field

This disclosure relates to the field of video coding and compression, and particularly to video compression for transmission over display links, such as display stream compression (DSC).

Description of the Related Art

Digital video capabilities can be incorporated into a wide range of displays, including digital televisions, personal digital assistants (PDAs), laptop computers, desktop monitors, digital cameras, digital recording devices, digital media players, video gaming devices, video game consoles, cellular or satellite radio telephones, video teleconferencing devices, and the like. Display links are used to connect displays to appropriate source devices. The bandwidth requirements of display links are proportional to the resolution of the displays, and thus, high-resolution displays require large bandwidth display links. Some display links do not have the bandwidth to support high resolution displays. Video compression can be used to reduce the bandwidth requirements such that lower bandwidth display links can be used to provide digital video to high resolution displays.

Others have tried to utilize image compression on the pixel data. However, such schemes are sometimes not visually lossless or can be difficult and expensive to implement in conventional display devices.

The Video Electronics Standards Association (VESA) has developed display stream compression (DSC) as a standard for display link video compression. The display link video compression technique, such as DSC, should provide, among other things, picture quality that is visually lossless (i.e., good enough that users cannot tell the compression is active). The display link video compression technique should also provide a scheme that is easy and inexpensive to implement in real-time with conventional hardware.

SUMMARY

The systems, methods and devices of this disclosure each have several innovative aspects, no single one of which is solely responsible for the desirable attributes disclosed herein.

In one aspect, an apparatus for coding video data includes a memory for storing the video data and a processor. The memory includes a buffer. The processor is configured to receive the video data to be coded. The processor is further configured to determine a Lagrangian parameter for a coding mode based at least in part on a bit rate of the coding mode and a fullness of the buffer.

BRIEF DESCRIPTION OF THE DRAWINGS

FIG. 1A is a block diagram illustrating an example video encoding and decoding system that may utilize techniques in accordance with aspects described in this disclosure.

FIG. 1B is a block diagram illustrating another example video encoding and decoding system that may perform techniques in accordance with aspects described in this disclosure.

FIG. 2A is a block diagram illustrating an example of a video encoder that may implement techniques in accordance with aspects described in this disclosure.

FIG. 2B is a block diagram illustrating an example of a video decoder that may implement techniques in accordance with aspects described in this disclosure.

FIG. 3 is a flowchart illustrating a method for Lagrangian parameter calculation in accordance with aspects described in this disclosure.

DETAILED DESCRIPTION

In general, this disclosure relates to techniques for determining a Lagrangian parameter in the context of video compression techniques, such as display stream compression (DSC). While certain embodiments are described herein in the context of the DSC standard, one having ordinary skill in the art would appreciate that systems and methods disclosed herein may be applicable to any suitable video coding standard. For example, embodiments disclosed herein may be applicable to one or more of the following standards: International Telecommunication Union (ITU) Telecommunication Standardization Sector (ITU-T) H.261, International Organization for Standardization/International Electrotechnical Commission (ISO/IEC) Moving Picture Experts Group-1 (MPEG-1) Visual, ITU-T H.262 or ISO/IEC MPEG-2 Visual, ITU-T H.263, ISO/IEC MPEG-4 Visual, ITU-T H.264 (also known as ISO/IEC MPEG-4 AVC), and High Efficiency Video Coding (HEVC), and extensions of such standards. Also, the techniques described in this disclosure may become part of standards developed in the future. In other words, the techniques described in this disclosure may be applicable to previously developed video coding standards, video coding standards currently under development, and forthcoming video coding standards.

A Lagrangian cost may be calculated for each mode in DSC by considering both the rate and distortion as: Cost=D+λR, where D represents the distortion associated with a particular coding mode and R represents the corresponding bit rate. Here, λ may refer to a Lagrangian multiplier that balances the distortion and the rate. The Lagrangian multiplier (λ) can affect the determination of the rate-distortion performance at the coder (e.g., decoder). For example, a smaller value of λ tends to result in the selection of a coding mode that has very small distortion, which may result in buffer overflow if the rate of the selected coding mode is very high, for example, relative to the other possible coding modes. On the other hand, a higher value of λ tends to result in the selection of a coding mode that has the minimum rate among the coding modes, which may affect the quality of the reconstructed image. Existing approaches may not properly calculate the parameter λ, which may result in suboptimal coding performance. For example, the existing approaches determine the parameter λ based on the quantization parameter (QP) and do not consider the bit rate and/or buffer fullness. Accordingly, it may be desirable to calculate the parameter λ in order to achieve an optimal coding performance.

In order to address these and other challenges, the techniques determine the Lagrangian parameter based on the bit rate and/or the level of fullness of a buffer (“buffer fullness”). For example, the techniques calculate a Lagrangian regularization parameter as a function of bit rate of a coding mode and buffer fullness. DSC may have several coding modes, and each coding mode has a bit rate associated with the respective coding mode. The techniques can determine the Lagrangian parameter for each coding mode based on the bit rate of the coding mode and the buffer fullness. In one embodiment, a first Lagrangian parameter or multiplier is calculated based on the bit rate ratio, and a second Lagrangian parameter or multiplier is calculated based on the buffer fullness. A combined Lagrangian parameter is calculated based on the first Lagrangian parameter and the second Lagrangian parameter (e.g., by multiplying or adding). The combined Lagrangian parameter value may be used to determine the Lagrangian cost for a coding mode. The techniques can compare the Lagrangian costs for the different coding modes and select a suitable coding mode based on the respective Lagrangian costs as appropriate.

In this manner, the techniques can determine a Lagrangian parameter that reflects the bit rate and/or the state of the buffer (e.g., the buffer fullness), which may be helpful in selecting a coding mode that is appropriate for a given situation. Considering the bit rate and the state of the buffer can provide a more accurate Lagrangian parameter value for determining the Lagrangian cost of a coding mode. More accurate Lagrangian costs can assist in selecting an optimal coding mode, leading to better image reconstruction quality.

Video Coding Standards

A digital image, such as a video image, a TV image, a still image or an image generated by a video recorder or a computer, may include pixels or samples arranged in horizontal and vertical lines. The number of pixels in a single image is typically in the tens of thousands. Each pixel typically contains luminance and chrominance information. Without compression, the sheer quantity of information to be conveyed from an image encoder to an image decoder would render real-time image transmission impractical. To reduce the amount of information to be transmitted, a number of different compression methods, such as JPEG, MPEG and H.263 standards, have been developed.

Video coding standards include ITU-T H.261, ISO/IEC MPEG-1 Visual, ITU-T H.262 or ISO/IEC MPEG-2 Visual, ITU-T H.263, ISO/IEC MPEG-4 Visual, ITU-T H.264 (also known as ISO/IEC MPEG-4 AVC), and HEVC including extensions of such standards.

In addition, a video coding standard, namely DSC, has been developed by VESA. The DSC standard is a video compression standard which can compress video for transmission over display links. As the resolution of displays increases, the bandwidth of the video data required to drive the displays increases correspondingly. Some display links may not have the bandwidth to transmit all of the video data to the display for such resolutions. Accordingly, the DSC standard specifies a compression standard for interoperable, visually lossless compression over display links.

The DSC standard is different from other video coding standards, such as H.264 and HEVC. DSC includes intra-frame compression, but does not include inter-frame compression, meaning that temporal information may not be used by the DSC standard in coding the video data. In contrast, other video coding standards may employ inter-frame compression in their video coding techniques.

Video Coding System

Various aspects of the novel systems, apparatuses, and methods are described more fully hereinafter with reference to the accompanying drawings. This disclosure may, however, be embodied in many different forms and should not be construed as limited to any specific structure or function presented throughout this disclosure. Rather, these aspects are provided so that this disclosure will be thorough and complete, and will fully convey the scope of the disclosure to those skilled in the art. Based on the teachings herein one skilled in the art should appreciate that the scope of the disclosure is intended to cover any aspect of the novel systems, apparatuses, and methods disclosed herein, whether implemented independently of, or combined with, any other aspect of the present disclosure. For example, an apparatus may be implemented or a method may be practiced using any number of the aspects set forth herein. In addition, the scope of the present disclosure is intended to cover such an apparatus or method which is practiced using other structure, functionality, or structure and functionality in addition to or other than the various aspects of the present disclosure set forth herein. It should be understood that any aspect disclosed herein may be embodied by one or more elements of a claim.

Although particular aspects are described herein, many variations and permutations of these aspects fall within the scope of the disclosure. Although some benefits and advantages of the preferred aspects are mentioned, the scope of the disclosure is not intended to be limited to particular benefits, uses, or objectives. Rather, aspects of the disclosure are intended to be broadly applicable to different wireless technologies, system configurations, networks, and transmission protocols, some of which are illustrated by way of example in the figures and in the following description of the preferred aspects. The detailed description and drawings are merely illustrative of the disclosure rather than limiting, the scope of the disclosure being defined by the appended claims and equivalents thereof.

The attached drawings illustrate examples. Elements indicated by reference numbers in the attached drawings correspond to elements indicated by like reference numbers in the following description. In this disclosure, elements having names that start with ordinal words (e.g., “first,” “second,” “third,” and so on) do not necessarily imply that the elements have a particular order. Rather, such ordinal words are merely used to refer to different elements of a same or similar type.

FIG. 1A is a block diagram that illustrates an example video coding system 10 that may utilize techniques in accordance with aspects described in this disclosure. As used described herein, the term “video coder” or “coder” refers generically to both video encoders and video decoders. In this disclosure, the terms “video coding” or “coding” may refer generically to video encoding and video decoding. In addition to video encoders and video decoders, the aspects described in the present application may be extended to other related devices such as transcoders (e.g., devices that can decode a bitstream and re-encode another bitstream) and middleboxes (e.g., devices that can modify, transform, and/or otherwise manipulate a bitstream).

As shown in FIG. 1A, video coding system 10 includes a source device 12 that generates encoded video data to be decoded at a later time by a destination device 14. In the example of FIG. 1A, the source device 12 and destination device 14 constitute separate devices. It is noted, however, that the source device 12 and destination device 14 may be on or part of the same device, as shown in the example of FIG. 1B.

With reference once again, to FIG. 1A, the source device 12 and the destination device 14 may respectively comprise any of a wide range of devices, including desktop computers, notebook (e.g., laptop) computers, tablet computers, set-top boxes, telephone handsets such as so-called “smart” phones, so-called “smart” pads, televisions, cameras, display devices, digital media players, video gaming consoles, video streaming device, or the like. In various embodiments, the source device 12 and the destination device 14 may be equipped for wireless communication.

The destination device 14 may receive, via link 16, the encoded video data to be decoded. The link 16 may comprise any type of medium or device capable of moving the encoded video data from the source device 12 to the destination device 14. In the example of FIG. 1A, the link 16 may comprise a communication medium to enable the source device 12 to transmit encoded video data to the destination device 14 in real-time. The encoded video data may be modulated according to a communication standard, such as a wireless communication protocol, and transmitted to the destination device 14. The communication medium may comprise any wireless or wired communication medium, such as a radio frequency (RF) spectrum or one or more physical transmission lines. The communication medium may form part of a packet-based network, such as a local area network, a wide-area network, or a global network such as the Internet. The communication medium may include routers, switches, base stations, or any other equipment that may be useful to facilitate communication from the source device 12 to the destination device 14.

In the example of FIG. 1A, the source device 12 includes a video source 18, video encoder 20 and the output interface 22. In some cases, the output interface 22 may include a modulator/demodulator (modem) and/or a transmitter. In the source device 12, the video source 18 may include a source such as a video capture device, e.g., a video camera, a video archive containing previously captured video, a video feed interface to receive video from a video content provider, and/or a computer graphics system for generating computer graphics data as the source video, or a combination of such sources. As one example, if the video source 18 is a video camera, the source device 12 and the destination device 14 may form so-called “camera phones” or “video phones”, as illustrated in the example of FIG. 1B. However, the techniques described in this disclosure may be applicable to video coding in general, and may be applied to wireless and/or wired applications.

The captured, pre-captured, or computer-generated video may be encoded by the video encoder 20. The encoded video data may be transmitted to the destination device 14 via the output interface 22 of the source device 12. The encoded video data may also (or alternatively) be stored onto the storage device 31 for later access by the destination device 14 or other devices, for decoding and/or playback. The video encoder 20 illustrated in FIGS. 1A and 1B may comprise the video encoder 20 illustrated FIG. 2A or any other video encoder described herein.

In the example of FIG. 1A, the destination device 14 includes the input interface 28, a video decoder 30, and a display device 32. In some cases, the input interface 28 may include a receiver and/or a modem. The input interface 28 of the destination device 14 may receive the encoded video data over the link 16 and/or from the storage device 31. The encoded video data communicated over the link 16, or provided on the storage device 31, may include a variety of syntax elements generated by the video encoder 20 for use by a video decoder, such as the video decoder 30, in decoding the video data. Such syntax elements may be included with the encoded video data transmitted on a communication medium, stored on a storage medium, or stored a file server.

The display device 32 may be integrated with, or external to, the destination device 14. In some examples, the destination device 14 may include an integrated display device and also be configured to interface with an external display device. In other examples, the destination device 14 may be a display device. In general, the display device 32 displays the decoded video data to a user, and may comprise any of a variety of display devices such as a liquid crystal display (LCD), a plasma display, an organic light emitting diode (OLED) display, or another type of display device.

In related aspects, FIG. 1B shows an example video coding system 10′ wherein the source device 12 and the destination device 14 are on or part of a device 11. The device 11 may be a telephone handset, such as a “smart” phone or the like. The device 11 may include a controller/processor device 13 (optionally present) in operative communication with the source device 12 and the destination device 14. The video coding system 10′ of FIG. 1B, and components thereof, are otherwise similar to the video coding system 10 of FIG. 1A, and components thereof.

The video encoder 20 and the video decoder 30 may operate according to a video compression standard, such as DSC. Alternatively, the video encoder 20 and the video decoder 30 may operate according to other proprietary or industry standards, such as the ITU-T H.264 standard, alternatively referred to as MPEG-4, Part 10, AVC, HEVC or extensions of such standards. The techniques of this disclosure, however, are not limited to any particular coding standard. Other examples of video compression standards include MPEG-2 and ITU-T H.263.

Although not shown in the examples of FIGS. 1A and 1B, the video encoder 20 and the video decoder 30 may each be integrated with an audio encoder and decoder, and may include appropriate MUX-DEMUX units, or other hardware and software, to handle encoding of both audio and video in a common data stream or separate data streams. If applicable, in some examples, MUX-DEMUX units may conform to the ITU H.223 multiplexer protocol, or other protocols such as the user datagram protocol (UDP).

The video encoder 20 and the video decoder 30 each may be implemented as any of a variety of suitable encoder circuitry, such as one or more microprocessors, digital signal processors (DSPs), application specific integrated circuits (ASICs), field programmable gate arrays (FPGAs), discrete logic, software, hardware, firmware or any combinations thereof. When the techniques are implemented partially in software, a device may store instructions for the software in a suitable, non-transitory computer-readable medium and execute the instructions in hardware using one or more processors to perform the techniques of this disclosure. Each of the video encoder 20 and the video decoder 30 may be included in one or more encoders or decoders, either of which may be integrated as part of a combined encoder/decoder in a respective device.

Video Coding Process

As mentioned briefly above, the video encoder 20 encodes video data. The video data may comprise one or more pictures. Each of the pictures is a still image forming part of a video. In some instances, a picture may be referred to as a video “frame.” When the video encoder 20 encodes the video data, the video encoder 20 may generate a bitstream. The bitstream may include a sequence of bits that form a coded representation of the video data. The bitstream may include coded pictures and associated data. A coded picture is a coded representation of a picture.

To generate the bitstream, the video encoder 20 may perform encoding operations on each picture in the video data. When the video encoder 20 performs encoding operations on the pictures, the video encoder 20 may generate a series of coded pictures and associated data. The associated data may include a set of coding parameters such as a QP. To generate a coded picture, the video encoder 20 may partition a picture into equally-sized video blocks. A video block may be a two-dimensional array of samples. The coding parameters may define a coding option (e.g., a coding mode) for every block of the video data. The coding option may be selected in order to achieve a desired rate-distortion performance.

In some examples, the video encoder 20 may partition a picture into a plurality of slices. Each of the slices may include a spatially distinct region in an image (e.g., a frame) that can be decoded independently without information from the rest of the regions in the image or frame. Each image or video frame may be encoded in a single slice or it may be encoded in several slices. In DSC, the target bits allocated to encode each slice may be substantially constant. As part of performing an encoding operation on a picture, the video encoder 20 may perform encoding operations on each slice of the picture. When the video encoder 20 performs an encoding operation on a slice, the video encoder 20 may generate encoded data associated with the slice. The encoded data associated with the slice may be referred to as a “coded slice.”

DSC Video Encoder

FIG. 2A is a block diagram illustrating an example of the video encoder 20 that may implement techniques in accordance with aspects described in this disclosure. The video encoder 20 may be configured to perform some or all of the techniques of this disclosure. In some examples, the techniques described in this disclosure may be shared among the various components of the video encoder 20. In some examples, additionally or alternatively, a processor (not shown) may be configured to perform some or all of the techniques described in this disclosure.

For purposes of explanation, this disclosure describes the video encoder 20 in the context of DSC coding. However, the techniques of this disclosure may be applicable to other coding standards or methods.

In the example of FIG. 2A, the video encoder 20 includes a plurality of functional components. The functional components of the video encoder 20 include a color-space converter 105, a buffer, 110, a flatness detector 115, a rate controller 120, a predictor, quantizer, and reconstructor component 125, a line buffer 130, an indexed color history 135, an entropy encoder 140, a substream multiplexor 145, and a rate buffer 150. In other examples, the video encoder 20 may include more, fewer, or different functional components.

The color-space 105 converter may convert an input color-space to the color-space used in the coding implementation. For example, in one exemplary embodiment, the color-space of the input video data is in the red, green, and blue (RGB) color-space and the coding is implemented in the luminance Y, chrominance green Cg, and chrominance orange Co (YCgCo) color-space. The color-space conversion may be performed by method(s) including shifts and additions to the video data. It is noted that input video data in other color-spaces may be processed and conversions to other color-spaces may also be performed.

In related aspects, the video encoder 20 may include the buffer 110, the line buffer 130, and/or the rate buffer 150. For example, the buffer 110 may hold the color-space converted video data prior to its use by other portions of the video encoder 20. In another example, the video data may be stored in the RGB color-space and color-space conversion may be performed as needed, since the color-space converted data may require more bits.

The rate buffer 150 may function as part of the rate control mechanism in the video encoder 20, which will be described in greater detail below in connection with rate controller 120. The bits spent on encoding each block can vary highly substantially based on the nature of the block. The rate buffer 150 can smooth the rate variations in the compressed video. In some embodiments, a constant bit rate (CBR) buffer model is employed in which bits are taken out from the buffer at a constant bit rate. In the CBR buffer model, if the video encoder 20 adds too many bits to the bitstream, the rate buffer 150 may overflow. On the other hand, the video encoder 20 must add enough bits in order to prevent underflow of the rate buffer 150.

On the video decoder side, the bits may be added to rate buffer 155 of the video decoder 30 (see FIG. 2B which is described in further detail below) at a constant bit rate, and the video decoder 30 may remove variable numbers of bits for each block. To ensure proper decoding, the rate buffer 155 of the video decoder 30 should not “underflow” or “overflow” during the decoding of the compressed bit stream.

In some embodiments, the buffer fullness (BF) can be defined based on the values BufferCurrentSize representing the number of bits currently in the buffer and BufferMaxSize representing the size of the rate buffer 150, i.e., the maximum number of bits that can be stored in the rate buffer 150 at any point in time. The BF may be calculated as: BF=((BufferCurrentSize*100)/BufferMaxSize)

The flatness detector 115 can detect changes from complex (i.e., non-flat) areas in the video data to flat (i.e., simple or uniform) areas in the video data. The terms “complex” and “flat” will be used herein to generally refer to the difficulty for the video encoder 20 to encode the respective regions of the video data. Thus, the term “complex” as used herein generally describes a region of the video data as being complex or difficult for the video encoder 20 to encode and may, for example, include textured video data, high spatial frequency, and/or other features which are complex to encode. For example, a region of the video data may be determined to be a complex region when the number of bits required to encode the region are greater than a threshold. The term “flat” as used herein generally describes a region of the video data as being simple for the video encoder 20 to encoder and may, for example, include a smooth gradient in the video data, low spatial frequency, and/or other features which are simple to encode. For example, a region of the video data may be determined to be a flat region when the number of bits required to encode the region are less than the threshold.

However, depending on the implementation, the determination of whether a given region is complex or flat may also be determined based on the encoding standard used, the specific hardware included in the video encoder 20, the type of video data to be encoded, etc. Further, certain properties of the video data regions may influence how many bits are required to encode the region, for example, high texture and/or high spatial frequency regions may require more bits to be encoded than lower texture and/or lower spatial frequency regions. Similarly, regions comprising random noise may be require a large number of bits to be encoded compared to more structured regions of the video data. Thus, in certain implementations, regions of the video data may be identified as complex and/or flat regions by comparing a measure of the texture and/or spatial frequency (e.g., a complexity value) to a complexity threshold. The transitions between complex and flat regions may be used by the video encoder 20 to reduce quantization artifacts in the encoded video data. Specifically, the rate controller 120 and the predictor, quantizer, and reconstructor component 125 can reduce such quantization artifacts when the transitions from complex to flat regions are identified.

The rate controller 120 determines a set of coding parameters, e.g., a QP. The QP may be adjusted by the rate controller 120 based on the buffer fullness of the rate buffer 150 and image activity of the video data in order to maximize picture quality for a target bitrate which ensures that the rate buffer 150 does not overflow or underflow. The rate controller 120 also selects a particular coding option (e.g., a particular mode) for each block of the video data in order to achieve the optimal rate-distortion performance. The rate controller 120 minimizes the distortion of the reconstructed images such that it satisfies the bit-rate constraint, i.e., the overall actual coding rate fits within the target bit rate.

The predictor, quantizer, and reconstructor component 125 may perform at least three encoding operations of the video encoder 20. The predictor, quantizer, and reconstructor component 125 may perform prediction in a number of different modes. One example predication mode is a modified version of median-adaptive prediction. Median-adaptive prediction may be implemented by the lossless JPEG standard (JPEG-LS). The modified version of median-adaptive prediction which may be performed by the predictor, quantizer, and reconstructor component 125 may allow for parallel prediction of three consecutive sample values. Another example prediction mode is block prediction. In block prediction, samples are predicted from previously reconstructed pixels to the left. The video encoder 20 and the video decoder 30 can both perform an identical search on reconstructed pixels to determine the block prediction usages, and thus, no bits need to be sent in the block prediction mode. A midpoint prediction mode may also be implemented in which samples are predicted using the midpoint of the component range. The midpoint prediction mode may enable bounding of the number of bits required for the compressed video in even the worst-case sample.

The predictor, quantizer, and reconstructor component 125 also performs quantization. For example, quantization may be performed via a power-of-2 quantizer which may be implemented using a shifter. It is noted that other quantization techniques may be implemented in lieu of the power-of-2 quantizer. The quantization performed by the predictor, quantizer, and reconstructor component 125 may be based on the QP determined by the rate controller 120. Finally, the predictor, quantizer, and reconstructor component 125 also performs reconstruction which includes adding the inverse quantized residual to the predicted value and ensuring that the result does not fall outside of the valid range of sample values.

It is noted that the above-described example approaches to prediction, quantization, and reconstruction performed by the predictor, quantizer, and reconstructor component 125 are merely illustrative and that other approaches may be implemented. It is also noted that the predictor, quantizer, and reconstructor component 125 may include subcomponent(s) for performing the prediction, the quantization, and/or the reconstruction. It is further noted that the prediction, the quantization, and/or the reconstruction may be performed by several separate encoder components in lieu of the predictor, quantizer, and reconstructor component 125.

The line buffer 130 holds the output from the predictor, quantizer, and reconstructor component 125 so that the predictor, quantizer, and reconstructor component 125 and the indexed color history 135 can use the buffered video data. The indexed color history 135 stores recently used pixel values. These recently used pixel values can be referenced directly by the video encoder 20 via a dedicated syntax.

The entropy encoder 140 encodes the prediction residuals received from the predictor, quantizer, and reconstructor component 125 based on the indexed color history 135 and the flatness transitions identified by the flatness detector 115. In some examples, the entropy encoder 140 may encode three samples per clock per substream encoder. The substream multiplexor 145 may multiplex the bitstream based on a headerless packet multiplexing scheme. This allows the video decoder 30 to run three entropy decoders in parallel, facilitating the decoding of three pixels per clock. The substream multiplexor 145 may optimize the packet order so that the packets can be efficiently decoded by the video decoder 30. It is noted that different approaches to entropy coding may be implemented, which may facilitate the decoding of power-of-2 pixels per clock (e.g., 2 pixels/clock or 4 pixels/clock).

DSC Video Decoder

FIG. 2B is a block diagram illustrating an example of the video decoder 30 that may implement techniques in accordance with aspects described in this disclosure. The video decoder 30 may be configured to perform some or all of the techniques of this disclosure. In some examples, the techniques described in this disclosure may be shared among the various components of the video encoder 30. In some examples, additionally or alternatively, a processor (not shown) may be configured to perform some or all of the techniques described in this disclosure.

For purposes of explanation, this disclosure describes the video decoder 30 in the context of DSC coding. However, the techniques of this disclosure may be applicable to other coding standards or methods.

In the example of FIG. 2B, the video decoder 30 includes a plurality of functional components. The functional components of the video decoder 30 include a rate buffer 155, a substream demultiplexor 160, an entropy decoder 165, a rate controller 170, a predictor, quantizer, and reconstructor component 175, an indexed color history 180, a line buffer 185, and a color-space converter 190. The illustrated components of the video decoder 30 are analogous to the corresponding components described above in connection with the video encoder 20 in FIG. 2A. As such, each of the components of the video decoder 30 may operate in a similar fashion to the corresponding components of the video encoder 20 as described above.

Slices in DSC

As noted above, a slice generally refers to a spatially distinct region in an image or a frame that can be decoded independently without using the information from the rest of the regions in the image or frame. Each image or video frame may be encoded in a single slice or it may be encoded in several slices. In DSC, the target bits allocated to encode each slice may be substantially constant.

Calculation of Lagrangian Parameter

Lagrangian cost may be provided by a Lagrangian cost function. For instance, a Lagrangian cost function can provide an alternate formulation to the constrained optimization problem (e.g., minimize f(x) subject to g(x)=c) in the form of an unconstrained optimization problem and generally be in the form of f(x)+λg(x). A cost may be calculated for each mode in DSC by considering both the rate and distortion as: Cost=D+λR, where D represents the distortion associated with a particular coding mode and R represents the corresponding bit rate. Here, λ may refer to a Lagrangian multiplier that balances the distortion and the rate.

The Lagrangian multiplier (λ) can affect the determination of the rate-distortion performance at the coder (e.g., decoder). For example, a smaller value of λ tends to result in the selection of a coding mode that has very small distortion, which may result in buffer overflow if the rate of the selected mode is very high. On the other hand, a higher value of λ tends to result in the selection of a mode that has the minimum rate among the modes, which may affect the quality of the reconstructed image. Existing approaches may not properly calculate the parameter λ, which may result in suboptimal coding performance. For example, the existing approaches determine the parameter λ based on the QP and do not consider the bit rate and/or buffer fullness. Accordingly, it may be desirable to calculate the parameter λ in order to achieve an optimal coding performance.

In order to address these and other challenges, the techniques determine the Lagrangian parameter based on the bit rate and buffer fullness. For example, the techniques calculate a Lagrangian regularization parameter as a function of bit rate of a coding mode and buffer fullness. DSC may have several possible (or available) coding modes. According to certain aspects, examples of coding modes can include: transform mode, block prediction mode, delta pulse code modulation (DPCM) mode (based on median adaptive prediction), pattern mode, pulse code modulation (PCM) mode, mean mode, midpoint prediction mode. Each coding mode has a bit rate associated with the respective coding mode. For example, the bit rate can represent the number of bits used by the mode, for example, to code a block. The techniques can determine the Lagrangian parameter for each coding mode based on the bit rate of the coding mode and the buffer fullness. In one embodiment, a first Lagrangian parameter or multiplier is calculated based on the bit rate ratio, and a second Lagrangian parameter or multiplier is calculated based on the buffer fullness. A combined Lagrangian parameter is calculated based on the first Lagrangian parameter and the second Lagrangian parameter (e.g., by multiplying or adding). The combined Lagrangian parameter value may be used to determine the Lagrangian cost for a coding mode. The techniques can compare the Lagrangian costs for the different coding modes and select a suitable coding mode as appropriate. In one embodiment, the coding mode with the lowest Lagrangian cost is selected.

In this manner, the techniques can determine a Lagrangian parameter that reflects the bit rate and/or the state of the buffer, which may be helpful in selecting a coding mode that is appropriate for a given situation. For example, when the buffer is close to overflowing (e.g., near a state of overflow), selecting a coding mode that has a smaller bit rate but has a higher distortion would be preferred in order to avoid buffer overflow, and when the buffer is in an underflow state, selecting a coding mode that has a higher bit rate but has a lower distortion would lead to better results. Considering the bit rate and the state of the buffer can provide a more accurate Lagrangian parameter value for determining the Lagrangian cost of a coding mode. For example, because DSC has a strict rate constraint (e.g., the CBR), the bit rate of a mode and buffer fullness can play an important role in maintaining the CBR. More accurate Lagrangian costs can assist in selecting an optimal coding mode, leading to better image reconstruction quality.

Certain details relating to determining the Lagrangian parameter in DSC are explained below, for example, in connection with the example embodiment. All features and/or embodiments described in this disclosure may be implemented separately or in combination. Various terms used throughout this disclosure are broad terms having their ordinary meaning. As used described herein, the term “video coder” refers generically to both video encoders and video decoders. In this disclosure, the terms “video coding” or “coding” may refer generically to video encoding and video decoding. In addition to video encoders and video decoders, the aspects described in the present application may be extended to other related devices such as transcoders (e.g., devices that can decode a bitstream and re-encode another bitstream) and middleboxes (e.g., devices that can modify, transform, and/or otherwise manipulate a bitstream).

Example Embodiment

In one embodiment, an apparatus and method are provided to calculate λ based on the bit rate and buffer fullness. For example, the λ may be calculated according to the steps described below. The example embodiment is explained in terms of encoding for illustrative purposes, and the techniques are also applicable to decoding. In general, coding may refer to both encoding and decoding. In certain embodiments, the terms Lagrangian multiplier and Lagrangian parameter may be used interchangeably.

1. Calculate a Lagrangian Multiplier Based on Bit-Rate Ratio

According to certain aspects, the techniques can calculate λ as a function of a bit-rate ratio (denoted as BR) that may be defined as the ratio of number of bits for encoding the current block with a particular mode divided by the maximum number of bits (denoted as maxBits): BR=number of bits/maxBits. Here, maxBits may correspond to the number of bits for encoding the visual information without any compression and may be calculated as follows: maxBits=number of pixels in the current block*bit depth*number of color components. Bit depth may refer to the number of bits for indicating each color component of a single pixel, e.g., 8 bits for RGB 888 image format.

-   -   A monotonically increasing function may be used to calculate the         λ value. For example, the value of λ increases as the bit-rate         ratio increases.     -   In one example, the following monotonically increasing function         may be used to calculate the λ:         a*2^((((BR*b)−c)/d)).     -   Here, a, b, c, and d are real constants that may be         configurable, and BR represents the bit-rate ratio.     -   In another example, while calculating maxBits, the additional         bits needed to signal the mode information may also be         considered (denoted here as additionalBits) in addition to the         bits needed to encode the current block without any compression.         The additional bits may be used to signal the header, which can         include mode information or other information. For example:         maxBits=maxBits+additionalBits.     -   In one example, the maxBits may be set equal to the minimum         value between the maxBits and the number of bits remaining the         slice, e.g., the actual bits left in the slice to encode the         rest of the blocks or pixels in the slice.     -   In another example, the λ value may be set to infinity when the         bit-rate ratio BR is strictly greater than 1.     -   In yet another example, the λ value for the first line in the         slice may not be the same when compared to the value of λ used         in the rest of the lines in the slice. For example, the λ value         for the first line in the slice may be calculated using:         m ₁*2^((((BR*m2)−m3)/m4)).     -   Here, m₁, m₂, m₃, and m₄ are real constants that are         configurable, and BR represents the bit-rate ratio.         2. Calculate a Lagrangian Multiplier Based on Buffer Fullness

Another λ value may be calculated as a function of BF. The penalty (e.g., λ) may be increased as the number of bits occupied in the buffer grows, so that the penalty would be strong and/or large when the buffer is about to overflow and small when the buffer is about to underflow. In some embodiments, the Lagrangian multiplier or parameter may be referred to as a penalty since the Lagrangian multiplier or parameter can act as a penalty against modes that are too expensive in terms of rate as the buffer reaches fullness.

-   -   A monotonically increasing function may be used to calculate the         λ value, e.g., the value of λ increases as the BF increases.     -   In one example, the following monotonically increasing function         may be used to calculate the λ:         a ₁*2^((((BF*b1)−c1)/d1)).     -   Here, a₁, b₁, c₁, and d₁ may be real constants that are         configurable.     -   In another example, the value of λ can be lower bound by a value         (e.g., Λ); this ensures that the penalty cannot be very small         which may help prevent the buffer from growing rapidly. More         precisely, the penalty may be calculated as:         Max(Λ,a ₁*2^((((BF*b) ¹ ^()−c) ¹ ^(/d) ¹ ⁾).     -   In one example, the buffer fullness value may be rounded to the         nearest integer using the following expression:         BF=((BufferCurrentSize*100)+(BufferMaxSize>>1))/BufferMaxSize.     -   The BF may be calculated in other ways, and the selected         approach to BF calculation may vary depending on the context and         application.     -   In another example, the BF may be normalized from 0 to 1, by         dividing BF by 100. The normalized BF value may be used to         calculate the λ value.     -   In yet another example, the λ value for the first line in the         slice may not be the same when compared to the value of λ used         in the rest of the lines in the slice. For example, the λ value         for the first line in the slice may be calculated using:         n ₁*2^((((BF*n2)−n3)/n4)).     -   Here, n₁, n₂, n₃ and n₄ are real constants that are         configurable, and BF represents the buffer fullness.         3. Calculate a Combined Lagrangian Parameter

The penalties (e.g., computed in steps 1 and 2 above) may be used to calculate λ in numerous ways. In one implementation, the penalties may be multiplied to calculate a single λ value, such that the calculated λ value depends on the bit rate and the BF.

-   -   For example, a single λ value may be computed as         (a*2^((((BR*b)−c)/d)))*(a₁*2^((((BF*b1)−c1)/d1))).     -   In related aspects, the same λ value may be used for all the         lines in the slice.     -   In further related aspects, a different λ value may be used for         the first line in the slice compared to penalty used in the rest         of the lines in the slice.     -   In yet further related aspects, a single λ value may be computed         for the first line in the slice as         (m₁*2^((((BR*m2)−m3)/m4)))*(n₁*2^((((BF*n2)−n3)/n4))).     -   In still further related aspects, a single λ value may be         computed for the first line in the slice as         (m₁*2^((((BR*m2)−m3)/m4)))*(a₁*2^((((BF*b1)−c1)/d1))).     -   In related aspects, a single λ value may be computed for the         first line in the slice as         (a*2^(((BR*b)−/c/d)))*(n₁*2^((((BF*n2)−n3)/n4))).

In other embodiments, the penalties (e.g., computed according to steps 1 and 2 above) may be added together to calculate a single λ value, so that the calculated λ value depends on the bit rate and the BF.

-   -   For example, a single λ value is computed as         (a*2^((((BR*b)−c)/d)))+(a₁*2^(((BF*b1)−c1)/d1))).     -   In related aspects, a single λ value may be computed for the         first line in the slice as         (m₁*2^((((BR*m2)−m3)/m4)))+(n₁*2^((((BF*n2)−n3)/n4))).     -   In further related aspects, a single λ value may be computed for         the first line in the slice as         (m₁*2^((((BR*m2)−m3)/m4)))*(a₁*2^((((BF*b1)−c1)/d1))).     -   In yet further related aspects, a single λ value may be computed         for the first line in the slice as         (a*2^((((BR*b)−c)/d)))*(n₁*2^((((BF*n2)−n3)/n4))).         4. Compare Lagrangian Costs for Different Modes and Select a         Mode

For each mode in DSC, the Lagrangian parameter (e.g., as calculated in step 3 above) can be used to determine the Lagrangian cost. As explained above, the Lagrangian cost can be calculated as: Cost=D+λR. The techniques may compare the Lagrangian costs for different modes and select an appropriate mode for coding the video data. In one embodiment, a mode that has the lowest Lagrangian cost is selected. In some embodiments, the mode having the lowest Lagrangian cost may have a rate that is too high, which can cause the buffer to overflow. Or coding the block using the mode having the lowest Lagrangian cost may take up so many bits that only a very small number of bits may be left to code the rest of the blocks in the slice. In such cases, the next best mode (e.g., mode having the second-lowest Lagrangian cost, the third-lowest Lagrangian cost, etc.) can be selected. For example, the next best mode that can prevent buffer overflow or that does not take up too many bits is selected.

Method of Determining Lagrangian Parameter in DSC

FIG. 3 is a flowchart illustrating a process 300 for coding video data, according to an embodiment of the present disclosure. The method relates to determining a Lagrangian parameter. The blocks of the process 300 may be performed by a video encoder (e.g., the video encoder 20 in FIG. 2A), a video decoder (e.g., the video decoder 30 in FIG. 2B), or component(s) thereof. For illustrative purposes, the process 300 is described as performed by a video coder (also simply referred to as coder), which may be the video encoder 20, the video decoder 30, or another component. All embodiments described with respect to FIG. 3 may be implemented separately, or in combination with one another. Certain details relating to the process 300 are explained above.

The process starts at block 301. The coder can include a memory for storing video data. The memory can include a buffer.

At block 302, the coder receives video data to be coded, for example, via DSC.

At block 303, the coder determines a Lagrangian parameter for a coding mode (e.g., associated with DSC), based at least in part on the bit rate of the coding mode and the fullness of the buffer. In one embodiment, the coder determines a first Lagrangian multiplier based on a bit rate ratio of a current block, wherein the bit ratio is a ratio of a number of bits for coding the current block using the coding mode divided by a number of bits for coding the current block without any compression, determines a second Lagrangian multiplier based on the fullness of the buffer, and determines the Lagrangian parameter (e.g., the combined Lagrangian parameter) based at least in part on the first Lagrangian multiplier and the second Lagrangian multiplier. The coder may determine the Lagrangian parameter via multiplying the first Lagrangian multiplier and the second Lagrangian multiplier. Or the coder may determine the Lagrangian parameter via adding the first Lagrangian multiplier and the second Lagrangian multiplier.

In another embodiment, the coder determines a first Lagrangian multiplier based on a bit rate ratio of a current block, wherein the bit ratio is a ratio of a number of bits for coding the current block using the coding mode divided by a sum of a number of bits for coding the current block without any compression and a number of bits for coding information associated with the coding mode, determines a second Lagrangian multiplier based on the fullness of the buffer, and determines the Lagrangian parameter (e.g., the combined Lagrangian parameter) based at least in part on the first Lagrangian multiplier and the second Lagrangian multiplier.

DSC can include a plurality of coding modes. In some embodiments, the coder obtains information relating to the plurality of coding modes, e.g., associated with DSC, determines respective Lagrangian parameters for each of the plurality of coding modes, selects a first coding mode of the plurality of coding modes based at least in part on the respective Lagrangian parameters, and code the current block in a bitstream using the first coding mode. In one embodiment, for each of the plurality of coding modes, the coder determines a Lagrangian cost associated with each coding mode, the Lagrangian cost determined as: a distortion of each coding mode+the Lagrangian parameter of each coding mode*the bit rate of each coding mode. The coder may selects as the first coding mode a coding mode of the plurality of coding modes having the lowest Lagrangian cost.

In certain embodiments, a slice including a current block includes a plurality of lines, the plurality of lines including a first line, and the Lagrangian parameter for the first line is determined in a different manner from other lines of the plurality of lines. In other embodiments, a slice including a current block includes a plurality of lines, the plurality of lines including a first line, and the Lagrangian parameter for the first line is determined in the same manner as other lines of the plurality of lines.

The process 300 ends at block 304. Blocks may be added and/or omitted in the process 300, depending on the embodiment, and blocks of the process 300 may be performed in different orders, depending on the embodiment.

Any features and/or embodiments described in this disclosure may be implemented separately or in any combination thereof. For example, any features and/or embodiments described in connection with FIGS. 1-2 and other parts of the disclosure may be implemented in any combination with any features and/or embodiments described in connection with FIG. 3, and vice versa. The embodiments of the present disclosure are not limited to or by the example shown in FIG. 3, and other variations may be implemented without departing from the spirit of this disclosure.

Other Considerations

Information and signals disclosed herein may be represented using any of a variety of different technologies and techniques. For example, data, instructions, commands, information, signals, bits, symbols, and chips that may be referenced throughout the above description may be represented by voltages, currents, electromagnetic waves, magnetic fields or particles, optical fields or particles, or any combination thereof.

The various illustrative logical blocks, and algorithm steps described in connection with the embodiments disclosed herein may be implemented as electronic hardware, computer software, or combinations of both. To clearly illustrate this interchangeability of hardware and software, various illustrative components, blocks, and steps have been described above generally in terms of their functionality. Whether such functionality is implemented as hardware or software depends upon the particular application and design constraints imposed on the overall system. Skilled artisans may implement the described functionality in varying ways for each particular application, but such implementation decisions should not be interpreted as causing a departure from the scope of the present disclosure.

The techniques described herein may be implemented in hardware, software, firmware, or any combination thereof. Such techniques may be implemented in any of a variety of devices such as general purposes computers, wireless communication device handsets, or integrated circuit devices having multiple uses including application in wireless communication device handsets and other devices. Any features described as devices or components may be implemented together in an integrated logic device or separately as discrete but interoperable logic devices. If implemented in software, the techniques may be realized at least in part by a computer-readable data storage medium comprising program code including instructions that, when executed, performs one or more of the methods described above. The computer-readable data storage medium may form part of a computer program product, which may include packaging materials. The computer-readable medium may comprise memory or data storage media, such as random access memory (RAM) such as synchronous dynamic random access memory (SDRAM), read-only memory (ROM), non-volatile random access memory (NVRAM), electrically erasable programmable read-only memory (EEPROM), FLASH memory, magnetic or optical data storage media, and the like. The techniques additionally, or alternatively, may be realized at least in part by a computer-readable communication medium that carries or communicates program code in the form of instructions or data structures and that can be accessed, read, and/or executed by a computer, such as propagated signals or waves.

The program code may be executed by a processor, which may include one or more processors, such as one or more digital signal processors (DSPs), general purpose microprocessors, an application specific integrated circuits (ASICs), field programmable logic arrays (FPGAs), or other equivalent integrated or discrete logic circuitry. Such a processor may be configured to perform any of the techniques described in this disclosure. A general purpose processor may be a microprocessor; but in the alternative, the processor may be any conventional processor, controller, microcontroller, or state machine. A processor may also be implemented as a combination of computing devices, e.g., a combination of a DSP and a microprocessor, a plurality of microprocessors, one or more microprocessors in conjunction with a DSP core, or any other such configuration. Accordingly, the term “processor,” as used herein may refer to any of the foregoing structure, any combination of the foregoing structure, or any other structure or apparatus suitable for implementation of the techniques described herein. In addition, in some aspects, the functionality described herein may be provided within dedicated software or hardware configured for encoding and decoding, or incorporated in a combined video encoder-decoder (CODEC). Also, the techniques could be fully implemented in one or more circuits or logic elements.

The techniques of this disclosure may be implemented in a wide variety of devices or apparatuses, including a wireless handset, an integrated circuit (IC) or a set of ICs (e.g., a chip set). Various components, or units are described in this disclosure to emphasize functional aspects of devices configured to perform the disclosed techniques, but do not necessarily require realization by different hardware units. Rather, as described above, various units may be combined in a codec hardware unit or provided by a collection of inter-operative hardware units, including one or more processors as described above, in conjunction with suitable software and/or firmware.

Although the foregoing has been described in connection with various different embodiments, features or elements from one embodiment may be combined with other embodiments without departing from the teachings of this disclosure. However, the combinations of features between the respective embodiments are not necessarily limited thereto. Various embodiments of the disclosure have been described. These and other embodiments are within the scope of the following claims. 

What is claimed is:
 1. An apparatus for coding video data, comprising: a memory for storing the video data, the memory including a buffer; and a hardware processor operationally coupled to the memory and configured to: receive the video data to be coded; and determine a Lagrangian parameter for a coding mode based at least in part on a bit rate ratio of a current block and an extent of a fullness of the buffer, wherein the bit rate ratio is based on a number of bits for coding the current block using the coding mode divided by a number of bits for coding the current block without the application of any compression.
 2. The apparatus of claim 1, wherein the processor is further configured to determine a first Lagrangian multiplier based on a bit rate ratio of the current block; determine a second Lagrangian multiplier based on the fullness of the buffer; and determine the Lagrangian parameter based at least in part on the first Lagrangian multiplier and the second Lagrangian multiplier.
 3. The apparatus of claim 2, wherein the processor is configured to multiply the first Lagrangian multiplier and the second Lagrangian multiplier.
 4. The apparatus of claim 2, wherein the processor is configured to add the first Lagrangian multiplier and the second Lagrangian multiplier.
 5. The apparatus of claim 1, wherein the processor is further configured to: determine a first Lagrangian multiplier based on a bit rate ratio of the current block; determine a second Lagrangian multiplier based on the fullness of the buffer; and determine the Lagrangian parameter based at least in part on the first Lagrangian multiplier and the second Lagrangian multiplier.
 6. The apparatus of claim 1, wherein the processor is further configured to: obtain information relating to a plurality of coding modes; determine respective Lagrangian parameters for each of the plurality of coding modes; select a first coding mode of the plurality of coding modes based at least in part on the respective Lagrangian parameters; and code a current block in a bitstream using the first coding mode.
 7. The apparatus of claim 6, wherein the processor is further configured to: for each of the plurality of coding modes, determine a Lagrangian cost associated with each coding mode, the Lagrangian cost determined as: a distortion of each coding mode+the Lagrangian parameter of each coding mode*the bit rate of each coding mode.
 8. The apparatus of claim 7, wherein the processor is further configured to select as the first coding mode a coding mode of the plurality of coding modes having the lowest Lagrangian cost.
 9. The apparatus of claim 1, wherein a slice including a current block includes a plurality of lines, the plurality of lines including a first line, and wherein the Lagrangian parameter for the first line is determined in a different manner from other lines of the plurality of lines.
 10. The apparatus of claim 1, wherein a slice including a current block includes a plurality of lines, the plurality of lines including a first line, and wherein the Lagrangian parameter for the first line is determined in the same manner as other lines of the plurality of lines.
 11. A method of coding video data, comprising: storing the video data in a memory, the memory including a buffer; receiving the video data to be coded; and determining a Lagrangian parameter for a coding mode based at least in part on a bit rate of ratio of a current block and an extent of a fullness of the buffer, wherein the bit rate ratio is based on a number of bits for coding the current block using the coding mode divided by a number of bits for coding the current block without the application of any compression.
 12. The method of claim 11 further comprising: determining a first Lagrangian multiplier based on a bit rate ratio of the current block; determining a second Lagrangian multiplier based on the fullness of the buffer; and determining the Lagrangian parameter based at least in part on the first Lagrangian multiplier and the second Lagrangian multiplier.
 13. The method of claim 12, the method further comprising multiplying the first Lagrangian multiplier and the second Lagrangian multiplier.
 14. The method of claim 11, the method further comprising adding the first Lagrangian multiplier and the second Lagrangian multiplier.
 15. The method of claim 11, the method further comprising: determining a first Lagrangian multiplier based on a bit rate ratio of the current block; determining a second Lagrangian multiplier based on the fullness of the buffer; and determining the Lagrangian parameter based at least in part on the first Lagrangian multiplier and the second Lagrangian multiplier.
 16. The method of claim 11, further comprising: obtaining information relating to a plurality of coding modes; determining respective Lagrangian parameters for each of the plurality of coding modes; selecting a first coding mode of the plurality of coding modes based at least in part on the respective Lagrangian parameters; and coding a current block in a bitstream using the first coding mode.
 17. The method of claim 16, further comprising: for each of the plurality of coding modes, determining a Lagrangian cost associated with each coding mode, the Lagrangian cost determined as: a distortion of each coding mode+the Lagrangian parameter of each coding mode*the bit rate of each coding mode.
 18. The method of claim 17, wherein a coding mode of the plurality of coding modes having the lowest Lagrangian cost is selected as the first coding mode.
 19. The method of claim 11, wherein a slice including a current block includes a plurality of lines, the plurality of lines including a first line, and wherein the Lagrangian parameter for the first line is determined in a different manner from other lines of the plurality of lines.
 20. The method of claim 11, wherein a slice including a current block includes a plurality of lines, the plurality of lines including a first line, and wherein the Lagrangian parameter for the first line is determined in the same manner as other lines of the plurality of lines.
 21. A non-transitory computer readable medium comprising instructions that when executed on a processor comprising computer hardware cause the processor to: store the video data in a memory, the memory including a buffer; receive the video data to be coded; and determine a Lagrangian parameter for a coding mode based at least in part on a bit rate ratio of a current block and an extent of a fullness of the buffer, wherein the bit ratio is base on a number of bits for coding the current block using the coding mode divided by a number of bits for coding the current block without the application of any compression.
 22. The computer readable medium of claim 21, wherein the instructions further cause the processor to: determine a first Lagrangian multiplier based on a bit rate ratio of the current block; determine a second Lagrangian multiplier based on the fullness of the buffer; and determine the Lagrangian parameter based at least in part on the first Lagrangian multiplier and the second Lagrangian multiplier.
 23. The computer readable medium of claim 21, wherein the instructions further cause the processor to: obtain information relating to a plurality of coding modes; determine respective Lagrangian parameters for each of the plurality of coding modes; select a first coding mode of the plurality of coding modes based at least in part on the respective Lagrangian parameters; and code a current block in a bitstream using the first coding mode.
 24. The computer readable medium of claim 23, wherein the instructions further cause the processor to: for each of the plurality of coding modes, determine a Lagrangian cost associated with each coding mode, the Lagrangian cost determined as: a distortion of each coding mode+the Lagrangian parameter of each coding mode*the bit rate of each coding mode.
 25. The computer readable medium of claim 24, wherein the instructions further cause the processor to select as the first coding mode a coding mode of the plurality of coding modes having the lowest Lagrangian cost.
 26. An apparatus for coding video information, comprising: means for storing the video data in a memory, the memory including a buffer; means for receiving the video data to be coded; and means for determining a Lagrangian parameter for a coding mode based at least in part on a bit rate ratio of a current block and an extent of a fullness of the buffer, wherein the bit ratio is based on a number of bits for coding the current block using the coding mode divided by a number of bits for coding the current block without the application of any compression.
 27. The apparatus of claim 26, wherein the means for determining the Lagrangian parameter is further configured to: determine a first Lagrangian multiplier based on a bit rate ratio of the current block; determine a second Lagrangian multiplier based on the fullness of the buffer; and determine the Lagrangian parameter based at least in part on the first Lagrangian multiplier and the second Lagrangian multiplier.
 28. The apparatus of claim 26, wherein the means for determining the Lagrangian parameter is further configured to: obtain information relating to a plurality of coding modes; determine respective Lagrangian parameters for each of the plurality of coding modes; select a first coding mode of the plurality of coding modes based at least in part on the respective Lagrangian parameters; and code a current block in a bitstream using the first coding mode.
 29. The apparatus of claim 28, wherein the means for determining the Lagrangian parameter is further configured to: for each of the plurality of coding modes, determine a Lagrangian cost associated with each coding mode, the Lagrangian cost determined as: a distortion of each coding mode+the Lagrangian parameter of each coding mode*the bit rate of each coding mode.
 30. The apparatus of claim 29, wherein the means for determining the Lagrangian parameter is further configured to select as the first coding mode a coding mode of the plurality of coding modes having the lowest Lagrangian cost. 